<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="catalog" tagdir="/WEB-INF/tags/catalog"%>
<%@ taglib prefix="content" tagdir="/WEB-INF/tags/content"%>
<head>
<c:if test="${empty param.direct or !param.direct}">
	<script type="text/javascript"	src="${ctxPath}/scripts/probiz/content/contentForm.js?rs=${appConfig.rs}"></script>
	<c:set var="ui_sortable_js" value="true" scope="request"/>
</c:if>
</head>

<content tag="buttons">
	<probiz:iconBtn btnType="save" onclick="saveContent();" disabled="yes"/>
	<probiz:iconBtn btnType="delete" onclick="deleteContent();" disabled="yes"/>
	<probiz:iconBtn btnType="updateExpired" onclick="updateExpiredContent();" disabled="yes"/>
	<probiz:iconBtn btnType="back" onclick="returnToList();" />
</content>

<div id="errorMsgExtraBar" class='warning_msg' style="display: none"/>
<div id="successMsgExtraBar" class="success_msg" style="display: none"/>

<div class="top clearfix">
	<ul class="tab" id="detail">
		<li class="curr">
			<a href="#tab-summary"><span><fmt:message key="contentDetail.tab.summary" /> </span> </a>
		</li>
		<li>
			<a href="#tab-other"><span><fmt:message key="contentDetail.tab.other" /> </span> </a>
		</li>
		<verFunc:verFuncValidate funcKey="contentRelated4Content">
			<li>
				<a href="#tab-related"><span><fmt:message key="contentDetail.tab.related" /> </span> </a>
			</li>
		</verFunc:verFuncValidate>
	</ul>
</div>

<div class="modify">
	<form:form method="post" cssClass="mainForm" id="contentForm" name="contentForm" commandName="content" action="${ctxPath}/content/content.html">
		<div id="tab-summary">
			<div class="p_edit_basic">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="com_modi_table">
					<tr>
						<th colspan="2" class="title"><h4><fmt:message key="contentDetail.group.basic"/><h4></th>
					</tr>
					<tr>
						<td valign="top"  width="550">				
       						<%@include file="include/contentFormSummary.jspf"%>
							<%@include file="include/contentFormValidPeriod.jspf"%>
       					</td>
       					<td valign="top">
       						<%@include file="include/contentFormImages.jspf"%>
       					</td>
       				</tr>
       			</table>
       		</div>	
			<%@include file="include/contentFormBody.jspf"%>
		</div>
		<div id="tab-other">
			<%@include file="include/contentFormSource.jspf"%>
			<%@include file="include/contentFormSEO.jspf"%>
		</div>
		<div id="tab-related">
			<%@include file="include/contentFormRelated.jspf"%>
		</div>
		
	</form:form>
</div>


<div style="display:none">
	<probiz:ui_tabs tabsId="detail" />
	<%-- 
	<probiz:plugin_upload fileInputId="contentImageUpload" uploadFileTypes="jpg"	uploadCategory="content" onComplete="uploadContentImagehandler" cssClass="upload_img_1"/>
	--%>
	<probiz:plugin_newUpload fileInputId="contentImageUpload" fileQueueId="imagefileQueue" fileDesc="JPG files" fileExt="*.jpg;*.JPG"	uploadCategory="content"  multi="true"  onComplete="uploadContentImagehandler"/>
	<catalog:contentCategorySelector selectorId="contentCategorySelector" callbackFunc="selectCategoryCallback"/>
	<content:contentSelector selectorId="contentSelector" callbackFunc="selectRelatedContentCallback" multiple="true"/>
</div>


<v:javascript formName="content" staticJavascript="false" />
<script type="text/javascript">

	displayButtons(${content.status}); //显示操作按钮
	//applyValidate(('categoryId'),"required"); 不能使用这种，因为form页面是用ajax load进来的
	applyValidate($j('#categoryId').get(0),"required");
	<%--start:初始化验证与变量--%>		
	initVariables();
	<%--end:初始化验证与变量--%>	
	
	<%--start:初始化媒体--%>
	<c:forEach items="${content.contentMedias}" var="media">
		<c:if test="${media.mediaType == 0}">
			addNewContentImage({mediaId:${media.contentMediaId},mediaUrl:'${media.mediaUrl}',mediaDescription:'${media.mediaDescription}'},${media.mediaType},false);
		</c:if>
	</c:forEach>
	showImageMoveIcons();
	<%--end:初始化媒体--%>
	
	<%--start:初始化关联文章--%>
	<c:forEach items="${content.relatedContents}" var="rc">
		addManulContent({"id":"${rc.content.contentId}","contentTitle":"${rc.content.contentTitle}","imageUrl":"${rc.content.imageUrl}"},${rc.contentRelatedType.contentRelatedTypeId});
	</c:forEach>
	<%--end:初始化关联文章--%>
	
	<%--start:sortable--%>
	<c:forEach items="${relatedTypeList}" var="relatedType">
		$j('#manualContentsDiv_${relatedType.contentRelatedTypeId}').sortable();
	</c:forEach>
	<%--end:  sortable--%>
	
	//start:quickTip 生成 原因：在tag中$j无法扑捉到对象;另外直接用id指定是为了提高在ie下的查找速度
	$j('[quickTip]').each(function(){
      	$j(this).after('<img id="'+this.id+'_tip" width="14" height="14" src="'+__ctxPath+'/images/validate/info.gif"/>');
		$j('#'+this.id+'_tip').PQuickTip({
	         source:'text',
	         title:'Help',
	         type:'help',
	         text:$j(this).attr("quickTip")
      	});
	
	});
	//end:quickTip 生成
</script>
